//
//  GLSlider.swift
//  uisliderDel
//
//  Created by quan on 2019/8/13.
//  Copyright © 2019 quan. All rights reserved.
//

import UIKit

class GLSlider: UISlider {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.minimumTrackTintColor = .init(red: 25/255.0, green: 194/255.0, blue: 255/255.0, alpha: 1.0)
        self.maximumTrackTintColor = .init(red: 1, green: 1, blue: 1, alpha: 0.3)
        self.setThumbImage(GLSlider.gl_image(named: "进度"), for: .normal)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func trackRect(forBounds bounds: CGRect) -> CGRect {
        return CGRect(x: 2.0, y: (bounds.height - 3.0)/2.0, width: bounds.width - 4.0, height: 3.0)
    }
    
    class func gl_image(named name: String) -> UIImage {
        let bundle = Bundle(path: (Bundle(for: self).resourcePath! + "/GLVideoPlayerForIJK.bundle"))
        if let image = UIImage(named: name, in: bundle, compatibleWith: nil) {
            return image
        }
        return UIImage()
    }
}
